﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WAD.WEB.AppCode;
using WAD.Model;
using WAD.DAL;
using WAD.DAL.Admin;
namespace WAD.WEB.Admin.Ajax
{
    /// <summary>
    /// FCSetting 的摘要说明
    /// </summary>
    public class FCSetting : AdminAjax
    {
        public override void AjaxMethodDispatch(String identity)
        {
            switch (identity)
            {
                case "getlist": this.GetList(); break;
                case "check": this.Check(); break;
            }
        }
        [QD.Web.Ajax.AjaxMethod]
        public void GetList()
        {
            int pageIndex = Parse.Int("page_index", 1);//当前页
            MFCSetting m = new MFCSetting()
            {
                user_id = Parse.Int("user_id", 0),
                state = Parse.Int("state", -1)
            };
            PageData pg = DAOFCSetting.GetListPage(m, pageIndex, 20, "id,user_id,wx_number,wx_picurl,wx_name,mobile,area1,area2,area3,state,(select nick_name from [user] where [user].id=user_id) as truename");
            if (pg.itemCount == 0)
                DataEmpty();
            else
                Success(pg);
        }
        /// <summary>
        /// 分享者审核
        /// </summary>
        [QD.Web.Ajax.AjaxMethod]
        public void Check()
        {
            int state = Parse.Int("state", -1);
            string ids = Parse.String("ids", "");
            if (state < 0 || string.IsNullOrEmpty(ids)) ParamError();

            DAOFCSetting.Check(state, ids);
            Success();
        }
    }
}